package the.workshop.milktea.interfaces.api;

import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.wisteria.framework.web.APIResult;
import the.workshop.milktea.interfaces.req.ProductListReq;
import the.workshop.milktea.service.TeaProductService;
import the.workshop.milktea.service.dto.ProductGetDTO;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "Tea")
@RestController
@RequestMapping("/api/tea/product")
public class ApiTeaProductController {

    @Resource
    private TeaProductService teaProductService;

    @PostMapping("/list")
    public APIResult<List<ProductGetDTO>> list(@RequestBody ProductListReq req) {
        return APIResult.success(teaProductService.getList(req));
    }

}
